package com.zyl.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zyl.entity.Computers;
import com.zyl.entity.Sections;
import com.zyl.service.ComputersService;
import com.zyl.util.Result;

@RestController
public class ComputersController {
	@Autowired
	private ComputersService computersService;
	
	//增加方法
	@RequestMapping("/dnAdd")
	public Result AddComputers(Computers cu) {
		Result c;
		if(computersService.save(cu)) {
			c = new Result(0,"添加成功");
		}else {c = new Result(1,"添加失败");}
		return c;
	}
	
	//全查方法
	@RequestMapping("/getAllaksjkajs")
	public List<Computers> getT() {
		return computersService.list();

	}
}
